Fast and Perfectly Rounding Decimal/Hexadecimal Conversions

Floating point conversion codes, generally embedded input/output services, facilitate communication between user and computer, the user conversant in base ten and the computer most fluent in base .

With the advent of System/360 in 1964, conversions between base ten and base sixteen entered a chaotic period. Errors and inconsistencies abounded: Compilers converted data inconsistently with one another; a number compiled might differ from the same number input to the compiled program; checkpoint/restart worked reliably only with unformatted I/O; and merely printing the number 1.0 yielded outputs ranging from .99998 to 1.0. The discontent as measured by semiannual Share resolutions seemed to peak with Share 33, in 1969, when four of the top five outstanding resolutions addressed conversion problems [3].

lmproved conversion codes appeared in the early 1970's with tbe advent of extended precision floating point architecture and System/370. In the course of adding extended precision subroutines to its math libraries, IBM rewrote conversion codes to achieve consistency and accuracy "near perfection," perfection defined as rounding to nearest. machine number or, for ties, to the nearest of greater magnitude. Conversion resolutions quickly disappeared from the proceedings of Share.

As customers seemed content, IBM only twiddled with its conversion codes until 1987, when a FORTRAN customer complained that 610.75 prinied as 610.7 (while 111.75 printed as 111.8). This customer complaint instigated a fresh look at fast and perfectly rounding floating point conversion.

By: Slishman, Gordon

Published in: RC15683 in 1990

LIMITED DISTRIBUTION NOTICE:

This Research Report is available. This report has been submitted for publication outside of IBM and will probably be copyrighted if accepted for publication. It has been issued as a Research Report for early dissemination of its contents. In view of the transfer of copyright to the outside publisher, its distribution outside of IBM prior to publication should be limited to peer communications and specific requests. After outside publication, requests should be filled only by reprints or legally obtained copies of the article (e.g., payment of royalties). I have read and understand this notice and am a member of the scientific community outside or inside of IBM seeking a single copy only.

RC15683.pdf

Questions about this service can be mailed to reports@us.ibm.com .